layui.use(['form','layer','layedit','laydate','upload'],function(){
    var form = layui.form
    layer = parent.layer === undefined ? layui.layer : top.layer,
        laypage = layui.laypage,
        upload = layui.upload,
        layedit = layui.layedit,
        laydate = layui.laydate,
        $ = layui.jquery;


    //登录按钮
    form.on("submit(submit)",function(data){
        console.log(data.field);
        $.ajax({
            type: "Post",
            url: "addMenu",
            dataType: "json",
            data:data.field,
            success: function(msg){
                if(msg.code == '-1'){
                    layer.msg(msg.msg,{time:0.6*1000});
                }
                if(msg.code =='1'){

                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                }
            }
        });
        return false;
    })



})